home *** CD-ROM | disk | FTP | other *** search
/ SPACE 1 / SPACE - Library 1 - Volume 1.iso / program / 356 / clipmod / clip.c next >
Encoding:
C/C++ Source or Header  |  1990-02-02  |  2.3 KB  |  87 lines

  1. /****************************************************************************\
  2. |*        CLIP.C                                                                *|
  3. |*--------------------------------------------------------------------------*|
  4. |*    by Russ Wetmore                                                            *|
  5. |*        Last revision:    11/04/86 15:03:12                                    *|
  6. \****************************************************************************/
  7.  
  8. /* Uncomment the proper line for your flavour of C */
  9. #define MEGAMAX 1
  10. /* #define ALCYON 1 */
  11.  
  12. /*------------------------------*\
  13. |*    includes                    *|
  14. \*------------------------------*/
  15. #include "osbind.h"
  16. #include "clip.h"
  17.  
  18. /*------------------------------*\
  19. |*    locals                        *|
  20. \*------------------------------*/
  21. GLOBAL    LONG    clp__Tmp;
  22.  
  23.  
  24. /*------------------------------*\
  25. |*    clipboard                    *|    TRAP #10 funnel
  26. \*------------------------------*/
  27.     LOCAL
  28.     VOID
  29. xyzzy()
  30. {
  31. #ifdef MEGAMAX
  32.     asm {
  33.     clipboard:
  34.         move.L    (A7)+,clp__Tmp(A4)        ; Save off return address
  35.         trap    #10
  36.         move.L    clp__Tmp(A4),-(A7)        ; (D0 should hold result, if any
  37.         rts
  38.     }
  39. #endif
  40. #ifdef ALCYON
  41.     asm(".globl _clipboar");            /* (Alcyon idents only 8 chars)        */
  42.     asm("_clipboar:");
  43.     asm("move.L (SP)+,_clp__Tmp");        /* This is safest way to do this    */
  44.     asm("trap #10");                    /* In case you include labels at    */
  45.     asm("move.L _clp__Tmp,-(SP)");        /* link time for debugging purposes    */
  46.     asm("rts");
  47. #endif
  48. }
  49.  
  50.  
  51. /*------------------------------*\
  52. |*    trapStatus                    *|    Fetch magic number (in supervisor mode)
  53. \*------------------------------*/
  54.     LOCAL
  55.     VOID
  56. trapStatus()
  57. {
  58. #ifdef MEGAMAX
  59.     asm {
  60.         suba.L    A0,A0                    ; Zero out A0
  61.         movea.L    0xA8(A0),A0                ; Fetch vector to trap dispatcher
  62.         move.L    2(A0),clp__Tmp(A4)        ; Fetch magic number from routine
  63.     }
  64. #endif
  65. #ifdef ALCYON
  66.     asm("suba.L A0,A0");
  67.     asm("movea.L $A8(A0),A0");
  68.     asm("move.L 2(A0),_clp__Tmp");
  69. #endif
  70. }
  71.  
  72. /*------------------------------*\
  73. |*    InfoClip                    *|    Special intervention for this call
  74. \*------------------------------*/
  75.     GLOBAL
  76.     WORD
  77. InfoClip(info)
  78.     clipInfo *info;
  79. {
  80.     Supexec(trapStatus);                /* Fetch vector & get magic number    */
  81.     if ( clp__Tmp != 0xFDB97531 )        /* If it's not what we're expecting    */
  82.         return ( 0 );                    /* ...blow it off and inform bozo    */
  83.  
  84.     (VOID)clipboard(0, info);            /* Go ahead and make the call        */
  85.     return ( -1 );                        /* Show success                        */
  86. }
  87.